//Εγγραφη στο συστημα για πιθανη καταχωρηση καταστηματος.
package Controllers;

import DAO.SignUp_Dao;
import Exceptions.DaoException;
import Interfaces.ISignUp_Dao;
import Models.SignUp;
import javax.swing.JOptionPane;

public class SignUp_Controller {

    public SignUp_Controller(SignUp_Dao signUp_Dao) {

    }

    public boolean Validate(String Name, String LastName, String Phone, String Email, String Username, String Password, String Repass)
            throws IllegalArgumentException, DaoException {
        boolean x = true;
        try {
            if (Name.isEmpty() || LastName.isEmpty() || Phone.isEmpty() || Email.isEmpty() || Username.isEmpty() || Password.isEmpty() || Repass.isEmpty()) {
                // JOptionPane.showMessageDialog(null, "Empty Field");
                x = false;
            } else if (!Email.contains("@") || !Email.contains(".") || Email.startsWith("@")) {
                //JOptionPane.showMessageDialog(null, "Wrong Email");
                x = false;
            } else if (Phone.matches("[0-9]+") == false) {
                //JOptionPane.showMessageDialog(null, "Wrong Phone");
                x = false;
            } else if (Phone.length() > 10 || Phone.length() < 10) {
                //JOptionPane.showMessageDialog(null, "Wrong Pone");
                x = false;
            } else if (!Password.equals(Repass)) {
                // JOptionPane.showMessageDialog(null, "Pass and Repass dont match");
                x = false;
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Error");
        }

        return x;

    }

}
